package com.bonc.event.model;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * @author donggui@bonc.com.cn
 * @version 2016 2016年6月28日 上午10:38:01
 */
public class BONCEvent {
	
	private String id;
	
	private String type;

	private String subtype;
	
	private String text;
	
	private double distance;
	
	/**
	 *  arguments of the event (each of type AceEventArgument)
	 */
	public ArrayList<BONCEventArgument> arguments = new ArrayList<BONCEventArgument>();
	/**
	 *  a list of the mentions of this event (each of type AceEventMention)
	 */
	public ArrayList<BONCEventMention> mentions = new ArrayList<BONCEventMention>();
	
	static HashMap<String, String> eventTypeMap = new HashMap<String, String>();

	static {
		//  -- person roles --
		eventTypeMap.put("Be-born","Life");
		eventTypeMap.put("Marry","Life");
		eventTypeMap.put("Divorcen","Life");
		eventTypeMap.put("Injure","Life");
		eventTypeMap.put("Die","Life");
		eventTypeMap.put("Transport","Movement");
		eventTypeMap.put("Transfer-Ownership","Transaction");
		eventTypeMap.put("Transfer-Money","Transaction");
		eventTypeMap.put("Start-Org","Business");
		eventTypeMap.put("Merge-Org","Business");
		eventTypeMap.put("Declare-Bankruptcy","Business");
		eventTypeMap.put("End-Org","Business");
		eventTypeMap.put("Attack","Conflict");
		eventTypeMap.put("Demonstrate","Conflict");
		eventTypeMap.put("Meet","Contact");
		eventTypeMap.put("Phone-Write","Contact");
		eventTypeMap.put("Start-Position","Personnel");
		eventTypeMap.put("End-Position","Personnel");
		eventTypeMap.put("Nominate","Personnel");
		eventTypeMap.put("Elect","Personnel");
		eventTypeMap.put("Arrest-Jail","Justice");
		eventTypeMap.put("Release-Parole","Justice");
		eventTypeMap.put("Trial-Hearing","Justice");
		eventTypeMap.put("Charge-Indict","Justice");
		eventTypeMap.put("Sue","Justice");
		eventTypeMap.put("Convict","Justice");
		eventTypeMap.put("Sentence","Justice");
		eventTypeMap.put("Fine","Justice");
		eventTypeMap.put("Execute","Justice");
		eventTypeMap.put("Extradite","Justice");
		eventTypeMap.put("Acquit","Justice");
		eventTypeMap.put("Appeal","Justice");
		eventTypeMap.put("Pardon","Justice");
	}
	
	public BONCEvent() {
		// TODO Auto-generated constructor stub
	}
	
	public BONCEvent (String id, String type, String subtype) {
		this.id = id;
		this.setType(type);
		this.subtype = subtype;
	}

	public void setId (String id) {
		this.id = id;
	}
	
	/**
	 *  add mention 'mention' to the event.
	 */

	public void addMention (BONCEventMention mention) {
		mentions.add(mention);
//		mention.event = this;
	}

	/**
	 *  add argument 'argument' to the event.
	 */

	public void addArgument (BONCEventArgument argument) {
		arguments.add(argument);
	}

	public String toString () {
		StringBuffer buf = new StringBuffer();
		buf.append("event_");
		buf.append(this.getId());
		buf.append(" type: "+type);
		buf.append(" ");
		buf.append(this.getDistance());
		buf.append(" {");
//		for (int i=0; i<arguments.size(); i++) {
//			BONCEventArgument arg = (BONCEventArgument) arguments.get(i);
//			buf.append(arg.toString());
//			buf.append(";");
//		}
		buf.append("} ");
		buf.append(this.getText());
		return buf.toString();
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getId() {
		return id;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public double getDistance() {
		return distance;
	}

	public void setDistance(double distance) {
		this.distance = distance;
	}
	
	
//	public String toString () {
//		StringBuffer buf = new StringBuffer();
//		buf.append("event ");
//		buf.append(type);
//		buf.append(" ");
//		buf.append(subtype);
//		buf.append("{");
////		for (int i=0; i<mentions.size(); i++) {
////			BONCEventMention mention = (BONCEventMention) mentions.get(i);
////			buf.append(mention.toString());
////		}
//		for (int i=0; i<arguments.size(); i++) {
//			BONCEventArgument arg = (BONCEventArgument) arguments.get(i);
//			buf.append(arg.toString());
//		}
//		buf.append("} ");
//		return buf.toString();
//	}

}
